package org.millioncall.yueyoga.admin.dao;

import java.util.List;
import java.util.Map;

import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.yueyoga.admin.model.Role;

public interface RoleDAO {

	public void save(Role role);

	public void delete(Role role);

	public Role findById(int id);

	public List<Role> findByProperty(String propertyName, Object value);

	public List<Role> findByName(String name);

	public List<Role> findByEnabled(Boolean enabled);

	public List<Role> findAll();

	public List<Role> findAllByNames(List<String> names, boolean needEnabled);

	public List<Role> findRolesByGroupId(String gpId);

	public List<Role> findRoleAll();

	public PaginatedList<Role> findRolesInPage(int start, int limit,
			Map<String, Object> map);

	public Role findRoleById(Integer id);

	public int updateRole(Map<String, Object> map);

	public int saveRole(Map<String, Object> map);

	public void deleteRoleByIds(int[] id);

	public void deleteRoleGroupById(int[] id);

	public List<Role> findRolesByGroupId(int gpId);

	/**
	 * 删除角色权限
	 * @param roleId
	 * @return
	 */
	public int deleteRoleAuthorities(Integer roleId);
	
	/**
	 * 保存角色权限
	 * @param map
	 * @return
	 */
	public int saveRoleAuthority(Map<String, String> map);
	
	public Role findRoleByName (String name);

}